#ifndef _KTV_TIMER_H_
#define _KTV_TIMER_H_

#include "ui_message_client.h"


namespace UI
{

Uint32 TimerCallback(Uint32 Interval, void* param);

class UI_Timer : public UI_MessageClient
{
public:
	UI_Timer(UI_MessageClient* pOwner = 0);
	virtual ~UI_Timer(void);
	void StartTimer(unsigned long int Interval, bool bAutoRestart = false);
	void StopTimer(void);
	bool IsRunning(void) { return m_TimerID != 0; }
	long int GetCount(void) const { return m_iCounter; }
	void ResetCount(void) { m_iCounter = 0; }
	UI_MessageClient* GetOwner(void) { return m_pOwner; }
	Uint32 TimerHit(Uint32 Interval);
	virtual bool HandleMessage(UI_Message* pMessage);
	virtual bool IfReceiveEvent(void) const { return true; };
protected:
	SDL_TimerID m_TimerID;
	bool m_bAutoRestart;
	long int m_iCounter;
	UI_MessageClient* m_pOwner;
};

}


#endif // _KTV_TIMER_H_

